﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterAdmin.master" AutoEventWireup="true" CodeBehind="Show_AllDataEmp.aspx.cs" Inherits="Project_Udrinkwater.PagesAdmin.Show_AllDataEmp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    
    <dx:ASPxRoundPanel ID="RPN_ShowAlldataEmp" runat="server" Width="100%" 
        HeaderText="ข้อมูลพนักงาน">
        <HeaderStyle Font-Size="Medium" HorizontalAlign="Left" />
        <PanelCollection>
<dx:PanelContent runat="server" SupportsDisabledAttribute="True">
     <dx:ASPxButton ID="bt_AddEmployee" runat="server" Text="เพิ่มพนักงาน" 
        onclick="bt_AddEmployee_Click" Theme="Youthful">
    </dx:ASPxButton>
    <dx:ASPxGridView ID="GV_ShowdataEmp" runat="server" AutoGenerateColumns="False" 
        DataSourceID="SqlDataSource_showdataEmp" KeyFieldName="Employee_ID" 
        Width="100%" Font-Size="Small" EnableCallBacks="False" 
         OnHtmlEditFormCreated="GV_ShowdataEmp_HtmlEditFormCreated" 
         OnRowUpdating="GV_ShowdataEmp_RowUpdating" >
        <Columns>
            <dx:GridViewCommandColumn Caption="รายการ" ShowInCustomizationForm="True" 
                VisibleIndex="14">
                <EditButton Visible="True">
                </EditButton>
                <DeleteButton Visible="True">
                </DeleteButton>
            </dx:GridViewCommandColumn>
            <dx:GridViewDataTextColumn FieldName="ID" ReadOnly="True" 
                ShowInCustomizationForm="True" VisibleIndex="0" Visible="False">
                <EditFormSettings Visible="False" />
            </dx:GridViewDataTextColumn>
           <dx:GridViewDataTextColumn FieldName="Employee_ID" 
                VisibleIndex="1" ReadOnly="True" Caption="รหัสพนักงาน">
            </dx:GridViewDataTextColumn>
            <dx:GridViewDataTextColumn FieldName="Prefix" VisibleIndex="2" 
                Caption="คำนำหน้า">
            </dx:GridViewDataTextColumn>
            <dx:GridViewDataTextColumn FieldName="FirstName" VisibleIndex="3" 
                Caption="ชื่อ">
            </dx:GridViewDataTextColumn>
            <dx:GridViewDataTextColumn FieldName="LastName" VisibleIndex="4" 
                Caption="นามสกุล">
            </dx:GridViewDataTextColumn>
            <dx:GridViewDataTextColumn FieldName="Address" VisibleIndex="5" 
                Caption="ที่อยู่">
            </dx:GridViewDataTextColumn>
            <dx:GridViewDataTextColumn FieldName="Tel" VisibleIndex="6" Caption="เบอร์โทร">
            </dx:GridViewDataTextColumn>
            <dx:GridViewDataTextColumn FieldName="Salary" VisibleIndex="7" 
                Caption="เงินเดือน">
            </dx:GridViewDataTextColumn>
            <dx:GridViewDataTextColumn FieldName="Password" 
                ShowInCustomizationForm="True" VisibleIndex="8" Visible="False">
            </dx:GridViewDataTextColumn>
            <dx:GridViewDataTextColumn FieldName="Departmernt_ID" 
                ShowInCustomizationForm="True" VisibleIndex="9" Caption="ตำแหน่ง">
            </dx:GridViewDataTextColumn>
            <dx:GridViewDataDateColumn FieldName="StartJob" VisibleIndex="10" 
                Caption="วันเริ่มงาน">
            </dx:GridViewDataDateColumn>
            <dx:GridViewDataComboBoxColumn FieldName="PROVINCE_ID" 
                ShowInCustomizationForm="True" VisibleIndex="11" Caption="จังหวัด">
                <PropertiesComboBox DataSourceID="Province" TextField="PROVINCE_NAME" 
                    ValueField="PROVINCE_ID" ValueType="System.Int32">
                </PropertiesComboBox>
            </dx:GridViewDataComboBoxColumn>
            <dx:GridViewDataComboBoxColumn FieldName="AMPHUR_ID" 
                ShowInCustomizationForm="True" VisibleIndex="12" Caption="อำเภอ">
                <PropertiesComboBox DataSourceID="SqlDataSource_Aumphur" 
                    TextField="AMPHUR_NAME" ValueField="AMPHUR_ID" ValueType="System.Int32">
                </PropertiesComboBox>
            </dx:GridViewDataComboBoxColumn>
            <dx:GridViewDataComboBoxColumn FieldName="DISTRICT_ID" 
                ShowInCustomizationForm="True" VisibleIndex="13" Caption="ตำบล">
                <PropertiesComboBox DataSourceID="SqlDataSource_District" 
                    TextField="DISTRICT_NAME" ValueField="DISTRICT_ID" ValueType="System.Int32">
                </PropertiesComboBox>
            </dx:GridViewDataComboBoxColumn>
        </Columns>
        <SettingsBehavior ConfirmDelete="True" />
        <SettingsText ConfirmDelete="ยืนยันการลบข้อมูลพนักงาน" />
        <Templates>
            <EditForm>
                <table style="width: 100%">
                    <tr>
                        <td align="right" style="width: 389px">
                            คำนำหน้าชื่อ :</td>
                        <td style="width: 238px">
                            <dx:ASPxTextBox ID="tb_Prefix" runat="server" Width="170px">
                            </dx:ASPxTextBox>
                        </td>
                        <td align="right" style="width: 127px">
                            &nbsp;</td>
                        <td>
                            &nbsp;</td>
                    </tr>
                    <tr>
                        <td align="right" style="height: 23px; width: 389px">
                            ชื่อ :</td>
                        <td style="height: 23px; width: 238px">
                            <dx:ASPxTextBox ID="tb_name" runat="server" Width="170px">
                            </dx:ASPxTextBox>
                        </td>
                        <td align="right" style="height: 23px; width: 127px">
                            นามสกุล :</td>
                        <td style="height: 23px">
                            <dx:ASPxTextBox ID="tb_lname" runat="server" Width="170px">
                            </dx:ASPxTextBox>
                        </td>
                    </tr>
                    <tr>
                        <td align="right" style="width: 389px">
                            ที่อยู่ :</td>
                        <td style="width: 238px">
                            <dx:ASPxTextBox ID="tb_Address" runat="server" Width="170px">
                            </dx:ASPxTextBox>
                        </td>
                        <td align="right" style="width: 127px">
                            &nbsp;</td>
                        <td>
                            &nbsp;</td>
                    </tr>
                    <tr>
                        <td align="right" style="width: 389px">
                            จังหวัด :</td>
                        <td style="width: 238px">
                            <dx:ASPxComboBox ID="CB_Province" runat="server" DataSourceID="Province" 
                                TextField="PROVINCE_NAME" ValueField="PROVINCE_ID" 
                                onselectedindexchanged="CB_Province_SelectedIndexChanged" 
                                AutoPostBack="True" ValueType="System.Int32">
                            </dx:ASPxComboBox>
                        </td>
                        <td align="right" style="width: 127px">
                            &nbsp;</td>
                        <td>
                            &nbsp;</td>
                    </tr>
                    <tr>
                        <td align="right" style="width: 389px">
                            อำเภอ :</td>
                        <td style="width: 238px">
                            <dx:ASPxComboBox ID="CB_Aumphur" runat="server" 
                                DataSourceID="SqlDataSource_Aumphur" TextField="AMPHUR_NAME" 
                                ValueField="AMPHUR_ID" 
                                onselectedindexchanged="CB_Aumphur_SelectedIndexChanged" 
                                AutoPostBack="True" ValueType="System.Int32">
                            </dx:ASPxComboBox>
                        </td>
                        <td align="right" style="width: 127px">
                            &nbsp;</td>
                        <td>
                            &nbsp;</td>
                    </tr>
                    <tr>
                        <td align="right" style="width: 389px">
                            ตำบล :</td>
                        <td style="width: 238px">
                            <dx:ASPxComboBox ID="CB_District" runat="server" 
                                DataSourceID="SqlDataSource_District" TextField="DISTRICT_NAME" 
                                ValueField="DISTRICT_ID" 
                                onselectedindexchanged="CB_District_SelectedIndexChanged" 
                                AutoPostBack="True" ValueType="System.Int32">
                            </dx:ASPxComboBox>
                        </td>
                        <td align="right" style="width: 127px">
                            &nbsp;</td>
                        <td>
                            &nbsp;</td>
                    </tr>
                    <tr>
                        <td align="right" style="width: 389px">
                            เงินเดือน :</td>
                        <td style="width: 238px">
                            <dx:ASPxTextBox ID="tb_salary" runat="server" Width="170px">
                            </dx:ASPxTextBox>
                        </td>
                        <td align="right" style="width: 127px">
                            ตำแหน่ง :</td>
                        <td>
                            <dx:ASPxComboBox ID="cb_department" runat="server" 
                                DataSourceID="SqlDataSource_Department" TextField="Department_Name" 
                                ValueField="Department_ID">
                            </dx:ASPxComboBox>
                        </td>
                    </tr>
                    <tr>
                        <td align="right" style="width: 389px">
                            วันเริ่มงาน :</td>
                        <td style="width: 238px">
                            <dx:ASPxDateEdit ID="dateedit" runat="server">
                            </dx:ASPxDateEdit>
                        </td>
                        <td align="right" style="width: 127px">
                            เบอร์โทรศัพท์ :</td>
                        <td>
                            <dx:ASPxTextBox ID="tb_tel" runat="server" Width="170px">
                            </dx:ASPxTextBox>
                        </td>
                    </tr>
                </table>
                <div style="text-align: right; padding: 2px 2px 2px 2px">
                <dx:ASPxGridViewTemplateReplacement ID="UpdateButton" ReplacementType="EditFormUpdateButton"
                        runat="server">
                    </dx:ASPxGridViewTemplateReplacement>
                    <dx:ASPxGridViewTemplateReplacement ID="CancelButton" ReplacementType="EditFormCancelButton"
                        runat="server">
                    </dx:ASPxGridViewTemplateReplacement>
                    </div>
                </EditForm>
        </Templates>
    </dx:ASPxGridView>
    <asp:SqlDataSource ID="SqlDataSource_Department" runat="server" 
        ConnectionString="<%$ ConnectionStrings:DB_Udrink %>" 
        SelectCommand="SELECT * FROM [TB_Department]"></asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlDataSource_showdataEmp" runat="server" 
        ConnectionString="<%$ ConnectionStrings:DB_Udrink %>" 
        SelectCommand="SELECT * FROM [TB_Employee]">
    </asp:SqlDataSource>
     <asp:SqlDataSource ID="SqlDataSource_District" runat="server" 
         ConnectionString="<%$ ConnectionStrings:DB_Udrink %>" 
         
         SelectCommand="SELECT * FROM [TB_District]">
     </asp:SqlDataSource>
     <asp:SqlDataSource ID="SqlDataSource_Aumphur" runat="server" 
         ConnectionString="<%$ ConnectionStrings:DB_Udrink %>" 
         
         SelectCommand="SELECT * FROM [TB_Amphur]">
     </asp:SqlDataSource>
     <asp:SqlDataSource ID="Province" runat="server" 
         ConnectionString="<%$ ConnectionStrings:DB_Udrink %>" 
         SelectCommand="SELECT * FROM [TB_Province]"></asp:SqlDataSource>
</dx:PanelContent>
</PanelCollection>
    </dx:ASPxRoundPanel>
</asp:Content>
